let _ =require("lodash");

function formatBalanceStr(count) {
    if (!count) return "0";
    if (typeof count == "string") {
      count = parseInt(count);
    }
    count = count / 1e18;
    let k = 1000;
    let currencyStr = ["", "K", "M", "G", "T","P"];
    let i = 0;
    for (let l = 0; l < 8; l++) {
      if (count / Math.pow(k, l) < 1) {
        break;
      }
      i = l;
    }
    return (
      (count / _.round(Math.pow(k, i))).toFixed(2) +
      " " +
      currencyStr[i] +
      "TCESS"
    );
  }

  console.log(formatBalanceStr("600000000000000000"));

  console.log(600000000000000000/1e18)

  6
  